<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // let arr = [6, 3, 9, 22, 16, 4, 7, 66]求该数组中大于平均值的数的个数，和小于平均值的个数。
    let arr = [6, 3, 9, 22, 16, 4, 7, 66]
    const ave = arr.reduce((prev, item) => {
      return prev + item
    }, 0) / arr.length
    console.log(ave);
    let sum = 0
    arr.map(item => item > ave && sum++)
    console.log(sum);
  </script>
</body>

</html>